<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Object.defineproperty方法</title>
</head>

<body>
    <script>
        let user = {
            name: 'yy',
            username: 'kk',

            get fullName() {
                return this.name + ' ' + this.username;
            },

            set fullName(value) {
                // 这个用到了新语法 结构赋值
                [this.username, this.name] = value.split(' ');
            }
        }

        user.fullName = 'Anlya'

        console.log(user.fullname);
        console.log(user.username);
    </script>
</body>

</html>